package fr.eisti.icc.data;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author clion
 */
@Entity
@Table(name="RESERVATION")
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Reservation implements Serializable {

    @Id
    @GeneratedValue
    @Column(name="id")
    
    private int id;
    @OneToOne(cascade = {CascadeType.ALL})
    @JoinColumn(name = "id_document")
    private Document document;
    @Column(name="dateDemandeReservation")
    private String dateDemandeReservation;
    
    @Column(name="emprunteur")
    private String emprunteur;

    public Reservation(){

    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {

        return id;
    }

    public Reservation( Document document, String dateDemandeReservation, String emprunteur) {
     //   this.id2="1822"+Math.random();
        this.document = document;
        this.dateDemandeReservation = dateDemandeReservation;
        this.emprunteur = emprunteur;
    }

    public String getEmprunteur() {
        return emprunteur;
    }

    public void setEmprunteur(String emprunteur) {
        this.emprunteur = emprunteur;
    }


    public void setDocument(Document document) {
        this.document = document;
    }



    public Document getDocument() {
        return document;
    }

    public String getDateDemandeReservation() {
        return dateDemandeReservation;
    }

    public void setDateDemandeReservation(String dateDemandeReservation) {
        this.dateDemandeReservation = dateDemandeReservation;
    }

    @Override
    public String toString() {
        return "Reservation{" + "id=" + id + ", document=" + document + ", dateDemandeReservation=" + dateDemandeReservation + ", emprunteur=" + emprunteur + '}';
    }

  

}
